package com.budwk.app.enterprise.services.impl;

import com.budwk.app.enterprise.models.ImportExportInformation;
import com.budwk.app.enterprise.services.ImportExportInformationService;
import com.budwk.starter.common.page.PageUtil;
import com.budwk.starter.common.page.Pagination;
import com.budwk.starter.database.service.BaseServiceImpl;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;

@IocBean(args = {"refer:dao"})
public class ImportExportInformationServiceImpl extends BaseServiceImpl<ImportExportInformation> implements ImportExportInformationService {
    public ImportExportInformationServiceImpl(Dao dao) {
        super(dao);
    }

    @Override
    public Pagination listByPage(ImportExportInformation bean) {
        Cnd cnd = Cnd.NEW();
        if (Strings.isNotBlank(bean.getPageOrderName()) && Strings.isNotBlank(bean.getPageOrderBy())) {
            cnd.orderBy(bean.getPageOrderName(), PageUtil.getOrder(bean.getPageOrderBy()));
        }
        return this.listPage(bean.getPageNo(), bean.getPageSize(), cnd);
    }
}
